package com.train.system.req.train;

import com.train.common.group.AddGroup;
import com.train.common.group.EditGroup;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalTime;

/**
 * TrainAddOrEditReq
 * @author baitiaojun
 * @createDate 2025-02-20 01:04:22
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class TrainAddOrEditReq {


    /**
     * id
     */
    @NotNull(message = "【id】不能为空", groups = {EditGroup.class})
    private Long id;

    /**
     * 车次编号
     */
    @NotBlank(message = "【车次编号】不能为空", groups = {AddGroup.class, EditGroup.class})
    @Pattern(regexp = "^[A-Za-z0-9]+$",
            message = "车次编号必须是数字和英文字母",
            groups = {AddGroup.class, EditGroup.class})
    private String code;

    /**
     * 车次类型|枚举[TrainTypeEnum]
     */
    @NotBlank(message = "【车次类型】不能为空", groups = {AddGroup.class, EditGroup.class})
    private String type;

    /**
     * 始发站
     */
    @NotBlank(message = "【始发站】不能为空", groups = {AddGroup.class, EditGroup.class})
    private String start;

    /**
     * 始发站拼音
     */
    @NotBlank(message = "【始发站拼音】不能为空", groups = {AddGroup.class, EditGroup.class})
    @Pattern(message = "始发站拼音只能包含字母", regexp = "^[A-Za-z]+$", groups = {AddGroup.class, EditGroup.class})
    private String startPinyin;

    /**
     * 出发时间
     */
    @NotNull(message = "【出发时间】不能为空", groups = {AddGroup.class, EditGroup.class})
    private LocalTime startTime;

    /**
     * 终点站
     */
    @NotBlank(message = "【终点站】不能为空", groups = {AddGroup.class, EditGroup.class})
    private String end;

    /**
     * 终点站拼音
     */
    @NotBlank(message = "【终点站拼音】不能为空", groups = {AddGroup.class, EditGroup.class})
    @Pattern(message = "终点站拼音只能包含字母", regexp = "^[A-Za-z]+$", groups = {AddGroup.class, EditGroup.class})
    private String endPinyin;

    /**
     * 到站时间
     */
    @NotNull(message = "【到站时间】不能为空", groups = {AddGroup.class, EditGroup.class})
    private LocalTime endTime;
}
